﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SimplePlanner.Entity
{
    public class DayTime: IComparable
    {
        public int hour;
        public int minute;
        public DayTime() { }
        public DayTime(int a, int b)
        {
            hour = a;
            minute = b;
        }
        
        
        public int CompareTo(Object obj )
        {
            if (obj is DayTime)
            {
                DayTime b = (DayTime)obj;
                if (hour < b.hour)
                    return -1;
                if (hour == b.hour)
                {
                    if (minute < b.minute)
                        return -1;
                    if (minute == b.minute)
                        return 0;
                }
                return 1;
            }
            return -1;
        }        

        public static bool operator < (DayTime a, DayTime b) 
        {
            if (a.hour < b.hour)
                return true;
            if (a.hour == b.hour && a.minute < b.minute)
                return true;
            return false;
        }
        
        public static bool operator >(DayTime a, DayTime b)
        {
            if (a.hour > b.hour)
                return true;
            if (a.hour == b.hour && a.minute > b.minute)
                return true;
            return false;
        }
    }
}
